package cn.caishen.report.domain.report;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import java.io.Serializable;

/**
 * 动态报表列字段
 */
@TableName(value = "tb_report_field")
@Data
@ApiModel(value = "动态报表列字段")
public class ReportField implements Serializable {

    /**
     * 报表字段编号
     */
    @TableId(value = "report_field_id", type = IdType.AUTO)
    @ApiModelProperty("报表字段编号")
    private Integer reportFieldId;

    /**
     * 报表设置编号
     */
    @TableField(value = "report_config_id")
    @ApiModelProperty("报表设置编号")
    private Integer reportConfigId;

    /**
     * 字段名称
     */
    @TableField(value = "field_name")
    @ApiModelProperty("字段名称")
    private String fieldName;

    /**
     * 字段别名
     */
    @TableField(value = "alias_field_name")
    @ApiModelProperty("字段别名")
    private String aliasFieldName;

    /**
     * 字段中文名称
     */
    @TableField(value = "field_cn_name")
    @ApiModelProperty("字段中文名称")
    private String fieldCnName;

    /**
     * 字段类型
     */
    @TableField(value = "field_type")
    @ApiModelProperty("字段类型")
    private String fieldType;

    /**
     * 字段长度
     */
    @TableField(value = "field_width")
    @ApiModelProperty("字段长度")
    private Integer fieldWidth;

    /**
     * 是否显示
     */
    @TableField(value = "on_show")
    @ApiModelProperty("是否显示")
    private Integer onShow;

    /**
     * 排序
     */
    @TableField(value = "order_by")
    @ApiModelProperty("排序")
    private Integer orderBy;

    /**
     * 是否显示明细
     */
    @TableField(value = "show_detail")
    @ApiModelProperty("是否显示明细")
    private Integer showDetail;

    /**
     * 明细报表配置编号
     */
    @TableField(value = "detail_report_config_id")
    @ApiModelProperty("明细报表配置编号")
    private Integer detailReportConfigId;

    /**
     * 需要合计
     */
    @TableField(value = "need_total")
    @ApiModelProperty("需要合计")
    private Integer needTotal;

    /**
     * 坐标轴(x或者y)
     */
    @TableField(value = "axis")
    @ApiModelProperty("坐标轴(x或者y)")
    private String axis;

    @Override
    public boolean equals(Object obj) {
        if (obj instanceof ReportField) {
            ReportField reportField = (ReportField) obj;
            return this.getFieldName().equals(reportField.getFieldName())
                    && this.getReportConfigId().equals(reportField.getReportConfigId());
        }
        return super.equals(obj);
    }

    @Override
    public int hashCode() {
        return super.hashCode();
    }
}
